import React from 'react';
import actions from "../../../../store/actions";
function hoc(WithComponent){
    return class hocComponent extends React.Component{
        //退出登录
        outLogin=()=>{
            this.props.dispatch(actions.actLogin.actOutLogin( {
                success:()=>{
                  this.props.history.replace(window.base.config.path+'login')
                }
            }))
        }
       goPage = (url)=>{
           this.props.history.replace(window.base.config.path+url)
       }
        render() {
            let newProps={
                outLogin:this.outLogin.bind(this),
                goPage:this.goPage.bind(this)
            }
            return(
                <WithComponent {...this.props} {...newProps}/>
            )
        }
    }
}
export default hoc